<template>
  <div :style="{'padding-left': `${paddingLeft}px`}" class="parent-node-root info-txt-container">
    <div @click.stop="" class="txt-container">

      <div class="title-container">
        <div class="title-txt">
          {{ data.inspectName }}
          <span class="state" :type="data.inspectState">
            <div class="state-decorate"></div>
            {{
              data.inspectState == INSPECT_STATE.draft ? '草稿' : (data.inspectState == INSPECT_STATE.official ? '进行中' : '已完成')
            }}
          </span>
        </div>
        <div @click.stop="showInfo" class="handel-container">
          {{ data.inspectState == INSPECT_STATE.draft ? '编辑' : '详情' }}
        </div>
      </div>
      <txt-row :txt-config="txtConfig" :data="data"></txt-row>
    </div>
    <div @click="changeBtClass" v-if="data.inspectState != INSPECT_STATE.draft" class="tree-show-bt">
      <i :class="btClassList[btIndex]"></i>
    </div>
  </div>
</template>

<script>
import TxtRow from "@/views/securityCheck/components/txtRow.vue";
import {INSPECT_STATE} from "@/constantData";

export default {
  components: {
    TxtRow
  },
  props: {
    data: {
      type: Object
    },
    paddingLeft: {
      type: Number
    },
    showLevel: {
      type: Number
    }
  },
  data() {
    return {
      btIndex: this.showLevel > 0 ? 1 : 0,
      btClassList: ['el-icon-arrow-right', 'el-icon-arrow-down'],
      INSPECT_STATE,
      txtConfig: [
        [
          {
            label: '检查年份',
            value: 'inspectYear'
          },
          {
            label: '层级',
            value: 'inspectLevelName'
          },
          {
            label: '检查批次',
            value: 'inspectBatch'
          },
          // {
          //   label: '下发组织',
          //   value: 'xfzz'
          // },
        ],
        [
          {
            label: '牵头组织',
            value: 'leadDepartment'
          },
          {
            label: '归属组织',
            value: 'belongOrgName'
          },
        ]
      ]
    }
  },
  methods: {
    changeBtClass() {
      this.btIndex = this.btIndex == 0 ? 1 : 0
    },
    showInfo() {
      this.$emit('showInfo', this.data)
    },
    getTypeName(){},
  }
}
</script>

<style scoped lang="scss">
.parent-node-root {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 20px;
  position: relative;

  .tree-show-bt {
    position: absolute;
    right: 30px;
    bottom: 15px;
  }
}
</style>
